/*! \file Device.h
 *	\brief <write description for Device.h>
 *
 *	created:	2010/04/10
 *	created:	10:4:2010   23:20
 *	filename: 	c:\src\tactics-engine\libs\gd_dx11\Device.h
 *	file path:	c:\src\tactics-engine\libs\gd_dx11
 *	file base:	Device
 *	file ext:	h
 *	author:		Vitalii Trubchaninov
 *				venngraydog@gmail.com
 */

#ifndef _GD_DX11_DEVICE_H_
#define _GD_DX11_DEVICE_H_

#pragma once

#include <gd/Device.h>
#include <utils/COMPointer.h>

namespace tt{

namespace app_win{
class Window;
} //namespace app_win

namespace gd_dx11{

class Driver;
class DeviceContext;

class Device : public gd::Device
{
public:
	Device(Driver*, const SharedPtr<app_win::Window>&);
	virtual ~Device(void);

	utils::COMPointer<ID3D11Device>& d3dDevice();

private:
	void createDevice(const SharedPtr<app_win::Window>&);
	void createRenderTargetView();
	void configureRasterizerState();

private:
	virtual void onPresent();

	virtual SharedPtr<gd::DeviceContext> onDeviceContext();
	
	virtual SharedPtr<gd::PrimitiveBuilder> onCreatePrimitiveBuilder();
	virtual SharedPtr<gd::ShaderBuilder> onCreateShaderBuilder();

private:
	utils::COMPointer<ID3D11Device> m_device;
	utils::COMPointer<IDXGISwapChain> m_swapChain;
	SharedPtr<DeviceContext> m_deviceContext;
	utils::COMPointer<ID3D11RasterizerState> m_rasterizerState;
};

//Device* toDevice(gd::DeviceContext*);

} //namespace gd_dx11
} //namespace tt

#endif //_GD_DX11_DEVICE_H_
